home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / heaptrk.zip / HEXX.PAS < prev    next >
Pascal/Delphi Source File  |  1993-01-04  |  804b  |  50 lines

  1.  
  2. UNIT Hexx;
  3.  
  4. Interface
  5. TYPE
  6.   string2 = STRING[2];
  7.   string4 = STRING[4];
  8.   string9 = String[9];
  9.  
  10. CONST
  11.   HexDigit : ARRAY[0..15] OF Char = '0123456789ABCDEF';
  12.  
  13.   FUNCTION HexByte(B : Byte) : string2;
  14.   FUNCTION HexW(I : Word) : string4;
  15.   Function HexPtr(P : Pointer) : String9;
  16.  
  17.  Implementation
  18.  
  19.   FUNCTION HexByte(B : Byte) : string2;
  20.   BEGIN
  21.     HexByte := HexDigit[B SHR 4]+HexDigit[B AND $F];
  22.   END;
  23.  
  24.   FUNCTION HexW(I : Word) : string4;
  25.   BEGIN
  26.     HexW := HexByte(Hi(I))+HexByte(Lo(I));
  27.   END;
  28.  
  29.   Function HexPtr(P : Pointer) : String9;
  30.   Var
  31.  
  32.    L : String4;
  33.     H : String4;
  34.  
  35.   Begin
  36.     If P = Nil then HexPtr := 'NIL      '
  37.     else
  38.     Begin
  39.       L := HexW(Lo(LongInt(P)));
  40.        H := HexW(Hi(LongInt(P)));
  41.        HexPtr := H+':'+L;
  42.     End;
  43.  
  44.    End;
  45.  
  46.  
  47.  
  48.  
  49.  
  50. End.